package com.tianbo.elfii.client.common;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;
import javax.swing.*;

public class InvalidTipDialog extends JPanel{

	public WlanAP connectingAP;
	
	public JButton confirmBtn;
	
    BufferedImage bgImg = null;
    
    public String titleStr = "Warning";
    public String tipStr = "产品未授权";
    public Font titleStrFont;
	
	public InvalidTipDialog(){
		
		titleStrFont = new Font(ElfiiCommonConstant.Font_Name,Font.PLAIN,26);
	}
    
	
	public void init(){
		this.setLayout(null);
		initImg();
		initBtn();
	}

	public void initImg(){
        File f;
        try {
            f=new File("resource-common/images/config/wlan/ss_03.png");
            bgImg=ImageIO.read(f);
            
        } catch(Exception e) {System.out.print(e);}
	}
	
	public void initBtn(){
		confirmBtn = new JButton();
		
		confirmBtn.setIcon(new ImageIcon("resource-common/images/login/sssss06.png"));
		
		confirmBtn.setContentAreaFilled(false);
		confirmBtn.setBorder(null);
		confirmBtn.setFocusPainted(false);

		confirmBtn.setBounds(202, 220, 141, 44);
		
		this.add(confirmBtn);
		
	}
	
	
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
      
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2.drawImage(bgImg,null,0,0);

        g2.setColor(Color.white);
        
        g2.setFont(titleStrFont);
    
        g2.drawString(titleStr, 100, 55);
        
        g2.setFont(new Font(ElfiiCommonConstant.Font_Name,Font.PLAIN,24));
        
        g2.drawString(tipStr, 210, 150);
    }
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		JFrame w = new JFrame();
		w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		w.setUndecorated(true); //
		w.setSize(545, 272);
//		w.show();
		InvalidTipDialog dialog = new InvalidTipDialog();
		dialog.setBounds(0, 0, 545, 272);
		dialog.init();
		w.setContentPane(dialog);
		w.show();
	}

}

